Method for controlling proximity sensor, device, and mobile terminal

ABSTRACT

The present disclosure provides a method for controlling a proximity sensor, a device, a storage medium and a mobile terminal. The method comprising outputting a driving signal, to a transmitting end and a receiving end of a proximity sensor, controlling the transmitting end to be in a sleep mode, an off mode, and an on mode periodically, controlling the receiving end to be in a sleep mode and a sampling mode periodically; controlling an analog-digital converter to store a first input signal, in a sampling period of the receiving end corresponding to the off mode, and controlling the analog-digital converter to clear the first input signal from a received second input signal, outputting a first intensity value corresponding to the second input signal after the clearing process, in a sampling period of the receiving end when it is in the on mode.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2018/091081 filed on Jun. 13, 2018, which claims priority toChinese Patent Application No. CN201710585063.1, filed on Jul. 18, 2017.The entire disclosures of the aforementioned applications areincorporated herein by reference.

TECHNICAL FIELD

The present disclosure relates to mobile terminal technologies, andparticularly to a method for controlling a proximity sensor, a device, astorage medium and a mobile terminal.

BACKGROUND

As smartphones move toward thinness, the size of their components isgetting smaller. In order to meet this requirement, the three-in-onesensor equipped with proximity sensor, ambient light sensor and infraredemitting light-emitting diode is widely used in smartphones.

Currently, smart phones automatically adjust the brightness of backlightof the liquid crystal display (LCD) through Ambient light sensor (ALS)monitoring the Ambient light intensity, or control the lighting andclosing of the button light. Proximity sensor (PS) including a infraredemitting light-emitting diode, among them, the infrared emittinglight-emitting diode as the sender of a proximity sensor, when used tocall by infrared emission launch, and through the proximity sensorreceiving end receives the face of the reflection of the infraredintensity values, according to the intensity values to judge whethersmartphone is close to the face, when the smartphone is closed to theface, it can close the LCD backlight, have the effect of energy saving.Meanwhile, for the capacitive touch screen, it is also possible to turnoff the drive signal output when it is close to the face to preventmisoperation.

However, the scenario of users using smart phones is complex andchangeable. For example, when the sunlight intensity is very high, theinfrared ray in the sunlight will be collected by the receiver close tothe ambient light sensor, so that the intensity of the infrared rayreceived by the receiver reaches tens of thousands of lux, and theinfrared ray emitted by the infrared emitting light-emitting diodeoccupies a very small proportion. As the approach to the sensorcharacteristic curve is non-linear, the linearity tends to be flat asthe low noise value (such as infrared in ambient light) increases.Therefore, in a bright light environment, the proximity value will besmaller, at this time, even if the smartphone is close to the face, itcouldn't control the screen off. For example, in the light boxenvironment, due to the infrared interference in the fluorescent lampcaused by the measured value of close to the high and low, so that themobile terminal cannot according to the face or the actual distancebetween the human ear and the screen, accurately control the screen onor off, and even may occur flashing screen problem.

SUMMARY

Therefore, the present disclosure provides a method for controlling aproximity sensor, a device, a storage medium and a mobile terminal, itcan optimize the control scheme of the proximity sensor and realize thenormal function of bright screen and off screen.

The embodiment of the present disclosure provides a method forcontrolling a proximity sensor, and the method includes:

outputting, a driving signal with a preset timing and a preset dutycycle, to a transmitting end and a receiving end of a proximity sensor,controlling the transmitting end to be in a sleep mode, an off mode, andan on mode periodically, and controlling the receiving end to be in asleep mode and a sampling mode periodically;controlling an analog-digital converter in the receiving end to store afirst input signal, in a sampling period of the receiving end when it isin the off mode; andcontrolling the analog-digital converter in the receiving end to clearthe first input signal from a received second input signal, andoutputting a first intensity value corresponding to the second inputsignal after the clearing process, thereby determining an approachingstate or a leaving state based on the first intensity value, in asampling period of the receiving end when it is in the on mode.

In one embodiment, the off mode comprises a first off mode and a secondoff mode, the operation of controlling the transmitting end to be in asleep mode, an off mode, and an on mode periodically includes:

controlling the transmitting end to be in the sleep mode, the first offmode, the on mode and the second off mode periodically; andthe operation of controlling an analog-digital converter in thereceiving end to store a first input signal in a sampling period of thereceiving end when the transmitting end is in the off mode comprises:controlling the analog-digital converter in the receiving end to storethe first input signal in a sampling period of the receiving end whenthe transmitting end is in the first off mode.

The embodiment of the disclosure also provides a controlling device fora proximity sensor, and the device includes:

a driving signal outputting module, configured to output a drivingsignal with a preset timing and a preset duty cycle, to a transmittingend and a receiving end of a proximity sensor, control the transmittingend to be in a sleep mode, an off mode, and an on mode periodically, andcontrol the receiving end to be in a sleep mode and a sampling modeperiodically;an input signal storing module, configured to control an analog-digitalconverter in the receiving end to store a first input signal in asampling period of the receiving end when it is in the off mode; anda first signal correction module, configured to control theanalog-digital converter in the receiving end to clear the first inputsignal from a received second input signal, and output a first intensityvalue corresponding to the second input signal after the clearingprocess, thereby determine an approaching state or a leaving state basedon the first intensity value, in a sampling period of the receiving endwhen it is in the on mode.

The embodiment of the disclosure also provides a storage medium having aprogram stored therein. When the program is executed by a processor, themethod for controlling a proximity sensor described in the embodiment ofthe disclosure is performed.

The embodiment of the disclosure also provides a mobile terminal, whichincludes a processor, a memory, and a program stored in the memory andexecutable by the processor, wherein the processor is configured toperform the method for controlling a proximity sensor described in theembodiment of the disclosure.

The method for controlling a proximity sensor, the device, the storagemedium and the mobile terminal, provided by the embodiment of thedisclosure, includes steps of: outputting, a driving signal with apreset timing and a preset duty cycle, to a transmitting end and areceiving end of a proximity sensor, controlling the transmitting end tobe in a sleep mode, an off mode, and an on mode periodically, andcontrolling the receiving end to be in a sleep mode and a sampling modeperiodically; controlling an analog-digital converter in the receivingend to store a first input signal, in a sampling period of the receivingend corresponding to the off mode; and controlling the analog-digitalconverter in the receiving end to clear the first input signal from areceived second input signal, and outputting a first intensity valuecorresponding to the second input signal after the clearing process,thereby determining an approaching state or a leaving state based on thefirst intensity value, in a sampling period of the receiving endcorresponding to the on mode. By deducting the infrared rays in theambient light in the analog-digital converter, the influence of theinfrared rays in the ambient light can be eliminated, and the problem ofthe screen not turned off when it is in the approaching state understrong light can be avoided. Meanwhile, the problem of the splash screenin the light box environment can be avoided, thereby achieving normalfunctions of the screen bright and off.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic structural view of a proximity sensor.

FIG. 2 is a schematic diagram of the operation of a proximity sensor.

FIG. 3 is a schematic diagram showing the control logic of atransmitting end and a receiving end of a proximity sensor under stronglight.

FIG. 4 is a schematic diagram showing the relationship between thecharacteristic curve and the ideal curve of the proximity sensor underslight ambient light.

FIG. 5 is a schematic diagram showing the relationship between thecharacteristic curve and the ideal curve of the proximity sensor understrong sunlight.

FIG. 6A is a schematic flowchart of a method for controlling a proximitysensor according to an embodiment of the present disclosure.

FIG. 6B is a schematic diagram showing the control logic of atransmitting end and a receiving end of a proximity sensor under stronglight, according to an embodiment of the present disclosure.

FIG. 7A is a schematic flowchart of another method for controlling aproximity sensor according to an embodiment of the present disclosure.

FIG. 7B is another schematic diagram showing the control logic of atransmitting end and a receiving end of a proximity sensor under stronglight, according to an embodiment of the present disclosure.

FIG. 8 is a schematic structural view of a controlling device for aproximity sensor according to an embodiment of the present disclosure.

FIG. 9 is a schematic structural view of a mobile terminal according toan embodiment of the present disclosure.

DETAILED DESCRIPTION

Before discussing exemplary embodiments in more detail, it should bementioned that some exemplary embodiments are described as processes ormethods described as flowcharts. Although flowcharts describe the stepsas sequential processing, many of them can be performed in parallel,concurrently, or simultaneously. In addition, the sequence of steps canbe rearranged. The processing can be terminated when its operation iscomplete, but it can also have additional steps not included in thediagram. The processing may correspond to methods, functions,procedures, subroutines, subroutines, etc.

In general, the function of the proximity sensor is to turn off thescreen, when the user calls and the phone is close to the face, toachieve power saving and anti-false touch. For example, when the useranswers or makes a call and the face is close to the phone, the screenis controlled to be turned off. If the user moves the phone away fromthe face and the proximity sensor is unobstructed, the screen iscontrolled to be turned on.

In order to better understand the working principle of a proximitysensor, FIG. 1 provides a schematic structural diagram of a proximitysensor. As illustrated in FIG. 1, the proximity sensor includes atransmitting end 131 and a receiving end 132, infrared rays are emittedfrom the infrared LED lamp of the transmitting end 131, and are receivedby the receiving end 132. The proximity sensor 130 is disposed in aspace formed by a display screen 120 and a housing, and may be disposednear a receiver. When an external blocking object 110 approaches theproximity sensor 130, the infrared rays emitted from the transmittingend 131 are reflected by the blocking object 110 and partially enter thereceiving end 132. An internal chip processor of the receiving end 132includes an analog-digital Converter (ADC), and an intensity value ofthe infrared rays entering the receiving end 132 is acquired by theanalog-digital converter. When there is no blocking object, theintensity value of the infrared ray acquired by the receiving end 132 isthe smallest, and when the blocking object is approaching, the intensityvalue of the infrared rays acquired by the receiving end 132 iscontinuously increased until the full scale is reached. Wherein, therange of the proximity sensor is related to the number of bits of theregister inside the receiving chip. For example, for an 8-bit register,the full-scale is 256; for a 10-bit register, the full-scale is 1024,for a 12-bit register, the full-scale is 4096, and so on. Then, theintensity value of the infrared rays acquired by the receiving end iscompared with a preset threshold, and the display screen is turned on orturned off according to the comparison result. For example, taking aproximity sensor with a 10-bit register as an example, the proximityvalue when the normal object is not blocked is 50. When the face is allclose to the proximity sensor, the infrared rays are all reflected tothe receiving end, and the proximity value is close to the full scale,which is about 1024.

In a non-bright light environment, it is usually prescribed that whenthe blocking object is 3-5 centimeter away, the screen is turned off,and when the blocking object is leaving away, the screen will also bechanged. It means that, an approaching threshold and a leaving thresholdmay be preset. Under the bright screen state, the screen is turned offwhen an approaching value is larger than the approaching threshold (suchas 400), under the off screen state, the screen is turned on when theapproaching value is less than the leaving threshold (such as 300).

In order to more vividly represent the working process of the proximitysensor, FIG. 2 is a schematic diagram of the operation of a proximitysensor. As illustrated in FIG. 2, a transmitting end 210, i.e., aninfrared LED lamp, and a receiving end 220 are disposed on a printedcircuit board 230 (or a flexible printed circuit board), and areisolated from each other. So the infrared rays cannot be directlytransmitted from the infrared LED lamp to the receiving end 220. A firstdriving circuit (not shown) is disposed on the printed circuit board230. As illustrated in FIG. 3, according to a preset control period, thefirst driving circuit outputs a control pulse to control the infraredLED lamp to be in a sleeping mode, an on mode (LED ON) and an off mode(LED OFF) periodically. Meanwhile, a second driving circuit (not shown)is disposed on the printed circuit board 230. According to a same presetcontrol period, the second driving circuit controls the receiving end toreceive infrared rays in a sleeping mode, a sampling mode, a sleepingmode, and so on, and to transmit the received infrared rays to theanalog-digital converter.

In one embodiment, the infrared rays emitted by the transmitting end 210are reflected by the blocking object and enter into the receiving end220. The receiving end 220 samples during the LED ON and LED OFFperiods. For example, the receiving end 220 performs two samplings undera strong light mode. The first sampling is to read the infraredintensity value of the receiving end 220 without turning on the LED lampof the transmitting end 210, and a first intensity value a is acquiredafter transmitting the infrared intensity value to the analog-digitalconverter. The second sampling is to read the infrared intensity valueof the receiving end 220 when the LED lamp of the transmitting end 210is turned on, and a second intensity value b is acquired aftertransmitting the infrared intensity value to the analog-digitalconverter. Then, an actual infrared signal strength value is (b−a).Comparing the actual infrared signal strength value with a presetthreshold, it can be determined that the mobile terminal is in anapproaching state or a leaving state. The sequence of the LED lamp modesis not limited. In another embodiment, as illustrated in FIG. 3, thereceiving end 220 performs two samplings with different sequence of theLED lamp modes. The first sampling is to read the infrared intensityvalue of the receiving end 220 when the LED lamp of the transmitting end210 is turned on, and a first intensity value a is acquired aftertransmitting the infrared intensity value to the analog-digitalconverter. The second sampling is to read the infrared intensity valueof the receiving end 220 when the LED lamp of the transmitting end 210is turned off, and a second intensity value b is acquired aftertransmitting the infrared intensity value to the analog-digitalconverter. Then, an actual infrared signal strength value is (a−b).Comparing the actual infrared signal strength value with a presetthreshold, it can be determined that the mobile terminal is in theapproaching state or the leaving state.

In one embodiment, when using the receiver to talk, the infrared raysemitted by the infrared LED lamp is reflected by the face into thereceiving end, the mobile terminal calculates, according to the abovedescribe manner, the proximity value by reading the infrared intensityvalue of the receiving end, and determines whether the mobile terminalis close to the face according to the proximity value. When the mobileterminal is determined to be close to the face, the LCD backlight isturned off to save power. Meanwhile, for a capacitive touch screen, thedriving signals are stopped to output to the touch screen, therebypreventing false touch. In addition, it is also possible to apply simplegesture recognition by setting a plurality of proximity sensors. Sincethe linearity of the proximity sensor chip (characteristic curve of theproximity sensor, that is, the solid line in FIG. 4 and FIG. 5) istechnically limited to achieve an ideal state (ideal curve, that is, thebroken line in FIG. 4 and FIG. 5). When the user uses the mobileterminal under strong light, the proximity value becomes smaller as thelow noise value becomes larger. As illustrated in FIGS. 4 and 5, theproximity value under strong sunlight (PS_ON-PS_OFF) is smaller than theproximity value under slight ambient light. Moreover, the stronger theambient infrared intensity, the higher the low noise, and the proximityvalue will become smaller and smaller. At this time, even if the mobileterminal is close to the face, the proximity value is still smaller thana first threshold, resulting in failure to extinguish the screen. Themethod for controlling a proximity sensor provided by the embodiment ofthe present application can solve the problem that failure to extinguishthe screen under strong light, as mentioned above.

FIG. 6A is a schematic flowchart of a method for controlling a proximitysensor according to an embodiment of the present disclosure. The methodcan be performed by a controlling device for proximity sensor. Wherein,the device can be implemented by at least one of software and hardware,and can generally be integrated in a mobile terminal. As illustrated inFIG. 6A, the method includes the following steps S610 to S630.

In a step S610, a driving signal with a preset timing and a preset dutycycle is outputted to a transmitting end and a receiving end of aproximity sensor, the transmitting end is controlled to be in a sleepmode, an off mode, and an on mode periodically, and the receiving end iscontrolled to be in a sleep mode and a sampling mode periodically.

The preset timing indicates the time sequence in which the LED lamp ofthe transmitting end is in the on mode, the off mode, and the sleepmode, and the time sequence in which the receiving end is in thesampling mode and the sleep mode. For example, as illustrated in FIG.6A, a driving signal for the transmitting end can control the LED lampof the transmitting end to sequentially enter the sleep mode, the offmode and the on mode in one control cycle according to the presettiming. For another example, a driving signal for the transmitting endcan also control the LED lamp of the transmitting end to sequentiallyexperience the off mode, the on mode and the sleep mode in one controlcycle according to the preset timing. A driving signal for the receivingend can control the receiving end to sequentially experience the sleepmode and the sampling mode in one control cycle according to the presettiming.

The duty cycle indicates how long the LED lamp of the transmitting endin the on mode, the off mode and the sleep mode respectively, and howlong the receiving end in the sampling mode and the sleep moderespectively. The LED lamp of the transmitting end and the receiving endare in the sleep mode most of the time, and the working time in onecontrol cycle is about 1/10. For example, the time distribution of theLED lamp in the off mode, the on mode and the sleep mode is about 1-1-8(i.e., the time that the LED lamp is in the off mode is about 1/10, thetime that the LED lamp is in the on mode is about 1/10, and the timethat the LED lamp is in the sleep mode is about 8/10). The timedistribution of the receiving end in the sampling mode and the sleepmode is about 2-8 (i.e., the time that the receiving end is in thesampling mode is about 2/10, and the time that the receiving end is inthe sleep mode is about 8/10).

The mobile terminal outputs a driving signal with a preset timing and apreset duty cycle to the LED lamp of the transmitting end and thereceiving end of a proximity sensor, the LED lamp of the transmittingend is controlled to be in the sleep mode, the off mode, and the on modeperiodically, and the receiving end is controlled to be in the sleepmode and the sampling mode periodically.

In a step S620, an analog-digital converter in the receiving end iscontrolled to store a first input signal, in a sampling period of thereceiving end when the transmitting end is in the off mode.

The first input signal is formed by the ambient infrared rays acquiredby the receiving end when the LED lamp of the transmitting end is in theoff mode. In the sampling period of the receiving end when the LED lampof the transmitting end is in the off mode, the receiving end iscontrolled to receive ambient infrared rays as the first input signal,and output the first input signal to the analog-digital converter of thereceiving end. It is should be noted, the analog-digital converterincludes a plurality of preset working units, and the plurality ofpreset working units are configured to store the first input signal. Itis understood that, the implementation hardware of the plurality ofworking units may be an electronic component having an energy storagefunction, such as a capacitor. Since the receiving end of the proximitysensor can receive infrared rays through the photodiode and convert theoptical signals into electrical signals as output, the output electricalsignal is recorded as the first input signal. The first input signal istransmitted to the analog-digital converter. The analog-digitalconverter is controlled to store the first input signal in the pluralityof preset working units, that is, the first input signal is stored bythe capacitor, which is worked as preset working units.

When the LED lamp of the receiving end is switched to the on mode fromthe off mode, the number of the preset working units occupied by thefirst input signal is recorded as a reference value. For example,assuming that the analog-digital converter has 1000 preset workingunits, the first input signal obtained by the receiving end is input tothe working units of the analog-digital converter in the sampling periodof the receiving end corresponding to the LED lamp in the off mode.Moreover, the first input signal is automatically stored in a nextworking unit after occupying one working unit. When the LED lamp of thereceiving end is switched to the on mode from the off mode, the numberof the preset working units occupied by the first input signal isrecorded. Assuming that the number of the preset working units occupiedby the first input signal is 300, then the reference value is determinedas 300. Then, the data in the preset working units that have beenoccupied by the first input signal can be cleared, so that the receivingend can store the second signal from the first one of the working units,in the sampling period of the receiving end when the LED lamp of thetransmitting end is in the on mode. Therefore, the storage space isprevented from being occupied by useless data, resulting in waste ofstorage resources. In one embodiment, the data in the preset workingunits that have been occupied by the first input signal may not becleared instantly, and the first input signal and the second inputsignal are uniformly cleared after a control cycle.

It is understood that, the manner of determining the reference valueenumerated in this embodiment is only one specific example, not limitedto determine the reference value.

In a step S630, the analog-digital converter in the receiving end iscontrolled to clear the first input signal from a received second inputsignal, and a first intensity value corresponding to the second inputsignal after the clearing process is outputted, thereby the proximitysensor is selectively in an approaching state and a leaving state isdetermined based on the first intensity value, in a sampling period ofthe receiving end when the transmitting end is in the on mode.

The second input signal is formed by ambient infrared rays and infraredrays received by the receiving end, and the infrared rays are emittedfrom the LED light and reflected by a blocking object when the LED lampof the transmitting end is in the on mode. In a sampling period of thereceiving end when the LED lamp of the transmitting end is in the onmode, the receiving end is controlled to acquire infrared rays andambient infrared rays as the second input signal, and the second inputsignal is outputted to the analog-digital converter, wherein theinfrared rays are emitted from the transmitting end and reflected by theblocking object. The analog-digital converter can be controlled to inputthe second input signal to the preset working units from the first oneof the working units. The analog-digital converter can also becontrolled to input the second input signal to the preset working unitsfrom a particular one with a preset number of the working units. Thedata in the preset working units that have been occupied by the secondinput signal is cleared, when the number of the preset working unitsoccupied by the second input signal is equal to the reference value.

When the screen is turned on, the first intensity value is compared witha first threshold, and the proximity sensor is determined in theapproaching state when the first intensity value is greater than thefirst threshold. The first threshold is a preset proximity threshold ofa display under a strong light environment.

When the screen is turned off, the first intensity value is comparedwith a second threshold, and the proximity sensor is determined in theleaving state when the first intensity value is less than the secondthreshold. Wherein the second threshold is a preset distant thresholdunder a strong light environment control by the display.

The method for controlling a proximity sensor provided by the embodimentof the disclosure, includes steps of: outputting, a driving signal witha preset timing and a preset duty cycle, to a transmitting end and areceiving end of a proximity sensor, controlling the transmitting end tobe in a sleep mode, an off mode, and an on mode periodically, andcontrolling the receiving end to be in a sleep mode and a sampling modeperiodically; controlling an analog-digital converter in the receivingend to store a first input signal, in a sampling period of the receivingend corresponding to the off mode; and controlling the analog-digitalconverter in the receiving end to clear the first input signal from areceived second input signal, and outputting a first intensity valuecorresponding to the second input signal after the clearing process,thereby determining an approaching state or a leaving state based on thefirst intensity value, in a sampling period of the receiving endcorresponding to the on mode. By deducting the infrared rays in theambient light in the analog-digital converter, the influence of theinfrared rays in the ambient light can be eliminated, and the problem ofthe screen not turned off when it is in the approaching state understrong light can be avoided. Meanwhile, the problem of the splash screenin the light box environment can be avoided, thereby achieving normalfunctions of the screen bright and off.

FIG. 7A is a schematic flowchart of another method for controlling aproximity sensor according to an embodiment of the present disclosure.As illustrated in FIG. 7A, the method includes the following steps ofS710 to S750.

In a step S710, a driving signal with a preset timing and a preset dutycycle is outputted to a transmitting end and a receiving end of aproximity sensor, the transmitting end is controlled to be in a sleepmode, a first off mode, an on mode and a second off mode periodically,and the receiving end is controlled to be in a sleep mode and a samplingmode periodically.

As illustrated in FIG. 7B, a driving signal can for the transmitting endcan control the LED lamp of the transmitting end to sequentially enterthe sleep mode, the first off mode, the on mode and the second off modein one control cycle according to the preset timing. For anotherexample, a driving signal for the transmitting end can also control theLED lamp of the transmitting end to sequentially enter the first offmode, the on mode, the second off mode and the sleep mode in one controlcycle according to the preset timing. The driving signal for thereceiving end can control the receiving end to sequentially enter thesleep mode and the sampling mode in one control cycle according to thepreset timing. Wherein, in one control cycle, the sampling period of thereceiving end corresponding to the sampling mode, is corresponding tothe sampling period of the transmitting end when it is in the first offmode, the on mode and the second off mode.

The LED lamp of the transmitting end and the receiving end are in thesleep mode most of the time in one control cycle, and the working timein one control cycle is about 1/10. For example, the time distributionof the LED lamp in the first off mode, the on mode, the second off modeand the sleep mode is about 1-1-1-7. Correspondingly, the timedistribution of the receiving end in the sampling mode and the sleepmode is about 3-7.

A driving signal with a preset timing and a preset duty cycle isoutputted from a mobile terminal, to the LED lamp of the transmittingend and the receiving end of a proximity sensor, the LED lamp of thetransmitting end is controlled to be in the sleep mode, the first offmode, the on mode and the second off mode periodically, and thereceiving end is controlled to be in the sleep mode and the samplingmode periodically.

In a step S720, an analog-digital converter in the receiving end iscontrolled to store a first input signal, in a sampling period of thereceiving end corresponding to the first off mode.

In one control cycle, the timing of the first mode is before the onmode. In the sampling period of the LED lamp of the transmitting endwhen it is in the first off mode, the receiving end is controlled toreceive ambient infrared rays as the first input signal, and output thefirst input signal to the analog-digital converter. The analog-digitalconverter stores the first input signal in a plurality of preset workingunits. When the LED lamp of the receiving end is switched to be in theon mode from the first off mode, the number of the preset working unitsoccupied by the first input signal is recorded as a reference value.

Then, the data in the preset working units that have been occupied bythe first input signal can be cleared, so that the receiving end canstore the second signal in the working units from the first one ofworking units, in the sampling period of the receiving end when the LEDlamp of the transmitting end is in the on mode. Illustratively, When thepreset working units is a capacitor, the method of clearing the data inthe occupied working units may be to ground the capacitor to introducethe electrical signal stored in the capacitor into the ground, therebyachieving the purpose of clearing the data.

In a step S730, the analog-digital converter in the receiving end iscontrolled to clear the first input signal from a received second inputsignal, and a first intensity value corresponding to the second inputsignal after the clearing process is outputted, in a sampling period ofthe receiving end corresponding to the on mode.

In a sampling period of the receiving end when the LED lamp of thetransmitting end is in the on mode, the receiving end is controlled toreceive infrared rays and ambient infrared rays as the second inputsignal, and the second input signal is outputted to the analog-digitalconverter.

The data in the preset working units that has been occupied by thesecond input signal is cleared when the number of the plurality ofpreset working units occupied by the second input signal is equal to thereference value.

Then, the data in the preset working units that has been occupied by thesecond input signal is cleared, so that, the receiving end can storesthe third input signal in the preset working units from the first one ofthe preset working units, in a sampling period of the receiving end whenthe LED lamp of the transmitting end is in the second off mode.

In a step S740, the analog-digital converter in the receiving end iscontrolled to clear the first input signal from a received third inputsignal, and a second intensity value corresponding to the third inputsignal is outputted after the clearing process, in a sampling period ofthe receiving end corresponding to the second off mode.

Wherein, in one control cycle, the timing of the second off mode isafter the on mode, so that, the receiving end is controlled to receiveambient infrared rays as the third input signal, and output the thirdinput signal to the analog-digital converter, in a sampling period ofthe receiving end when the LED lamp of the transmitting end is in thesecond off mode. The third input signal can be stored in the presetworking units. The analog-digital converter can store the third inputsignal in the preset working units from the first one of the workingunits. The analog-digital converter can also be controlled to store thesecond input signal to the preset working unit from a particular onewith a preset number of the working units.

The data in the preset working units that has been occupied by the thirdinput signal is cleared when the number of the preset working unitsoccupied by the third input signal is equal to the number of the presetworking units occupied by the first input signal. Since the process ofacquiring the third input signal by the receiving end is continuous, thereceiving end continues to acquire the third input signal when the LEDlamp of the transmitting end is in the second off mode, and the newlyreceived third input signal (the energy column corresponding to theinfrared component of the new ambient rays in FIG. 7B) is sent to theanalog-digital converter. The analog-digital converter performs aconverting process on the third input signal stored in the working unitsfrom analog signal to digital signal, when the LED lamp of thetransmitting end is switched to be in sleep mode from the second offmode, and the second intensity value corresponding to the third inputsignal after the clearing process is output.

In a step S750, an approaching state or a leaving state is determinedbased on the first intensity value and the second intensity value.

A proximity value is obtained by calculating an absolute value of thedifference between the first intensity value and the second intensityvalue, the proximity sensor is determined in the approaching state whenthe proximity value is greater than a first threshold, and the proximitysensor is determined in the leaving state when the proximity value isless than a second threshold. The benefits of this setup are: it isavoided that the first input signal is subtracted from the second inputsignal due to technical limitations, and the energy corresponding to theambient infrared component cannot be completely deducted, so that thefirst intensity value may affect the detection accuracy by including asmall amount of energy corresponding to the ambient infrared component.In addition, a jump of the proximity sensor is about 1% of the proximityvalue, and the difference between the first intensity value and thesecond intensity value can reduce the proximity value, make the jump ofthe proximity sensor more stable, and further improve the detectionaccuracy.

The method for controlling a proximity sensor provided by the embodimentof the disclosure, includes steps of: outputting, a driving signal witha preset timing and a preset duty cycle, to a transmitting end and areceiving end of a proximity sensor, controlling the transmitting end tobe in a sleep mode, a first off mode, an on mode and a second off modeperiodically, and controlling the receiving end to be in a sleep modeand a sampling mode periodically; controlling the analog-digitalconverter in the receiving end to clear the first input signal from areceived third input signal, and outputting a second intensity valuecorresponding to the third input signal after the clearing process, in asampling period of the receiving end corresponding to the second offmode, and determining the approaching state or the leaving state basedon the first intensity value and the second intensity value. Bydeducting the infrared rays in the ambient light in the analog-digitalconverter, the influence of the infrared rays in the ambient light canbe eliminated, and the problem of the screen not turned off when it isin the approaching state under strong light can be avoided. Meanwhile,the problem of the splash screen in the light box environment can beavoided, thereby achieving normal functions of the screen bright andoff.

FIG. 8 is a schematic structural view of a controlling device for aproximity sensor according to an embodiment of the present disclosure.The device is implemented by at least one of software and hardware, andis generally integrated in a mobile terminal. As illustrated in FIG. 8,the device includes a driving signal outputting module 810, an inputsignal storing module 820 and a first signal correction module 830.

The driving signal outputting module 810 is configured to output adriving signal with a preset timing and a preset duty cycle, to atransmitting end and a receiving end of a proximity sensor, control thetransmitting end to be in a sleep mode, an off mode, and an on modeperiodically, and control the receiving end to be in a sleep mode and asampling mode periodically.

The input signal storing module 820 is configured to control ananalog-digital converter in the receiving end to store a first inputsignal in a sampling period of the receiving end corresponding to theoff mode.

The first signal correction module 830 is configured to control theanalog-digital converter in the receiving end to clear the first inputsignal from a received second input signal, and output a first intensityvalue corresponding to the second input signal after the clearingprocess, thereby determine an approaching state or a leaving state basedon the first intensity value, in a sampling period of the receiving endcorresponding to the on mode.

In the controlling device for a proximity sensor provided by theembodiment of the disclosure, by changing the control method of thereceiving end and the transmitting end of the proximity sensor, anddeducting the infrared rays in the ambient light in the analog-digitalconverter, the influence of the infrared rays in the ambient light canbe eliminated, and the problem of the screen not turned off when it isin the approaching state under strong light can be avoided. Meanwhile,the problem of the splash screen in the light box environment can beavoided, achieving normal functions of the screen bright and off.

In one embodiment, the device further includes a second signalcorrection module 840 and a state determining module 850.

The second signal correction module 840, when the off mode comprises afirst off mode and a second off mode, is configured to control theanalog-digital converter in the receiving end to clear the first inputsignal from a received third input signal, and output a second intensityvalue corresponding to the third input signal after the clearingprocess, in a sampling period of the receiving end corresponding to thesecond off mode.

The state determining module 850 is configured to determine anapproaching state or a leaving state based on the first intensity valueand the second intensity value.

In one embodiment, the input signal storing module is configured tocontrol an analog-digital converter in the receiving end to store afirst input signal in a sampling period of the receiving endcorresponding to the off mode by execute the steps of:

controlling the receiving end to acquire ambient infrared rays as thefirst input signal, and outputting the first input signal to theanalog-digital converter in the receiving end, in the sampling period ofthe receiving end corresponding to the off mode;controlling the analog-digital converter to store the first input signalin a plurality of preset working units; andrecording the number of the preset working units occupied by the firstinput signal as a reference value, and clearing the preset data in theworking units that has been occupied by the first input signal, when thereceiving end is switched to be in the on mode from the off mode.

In one embodiment, the first signal correction module is configured tocontrol the analog-digital converter in the receiving end to clear thefirst input signal from a received second input signal, and output afirst intensity value corresponding to the second input signal after theclearing process, in a sampling period of the receiving endcorresponding to the on mode by execute the steps of:

in a sampling period of the receiving end corresponding to the on mode,control the receiving end to acquire infrared rays and ambient infraredrays as the second input signal, and output the second input signal tothe analog-digital converter, wherein the infrared rays are emitted fromthe transmitting end and reflected by a blocking object;controlling the analog-digital converter to store the second inputsignal in the preset working units; andclearing the preset data in the working units that has been occupied bythe second input signal when the number of the preset working unitsoccupied by the second input signal is equal to the reference value.

Wherein, when the off mode comprises a first off mode and a second offmode, the driving signal outputting module is configured to control thetransmitting end to be in a sleep mode, an off mode, and an on modeperiodically by execute the steps of:

controlling the transmitting end to be in the sleep mode, the first offmode, the on mode and the second off mode periodically; andthe input signal storing module is configured to control ananalog-digital converter in the receiving end to store a first inputsignal in a sampling period of the receiving end corresponding to theoff mode by execute the steps of:controlling the analog-digital converter in the receiving end to storethe first input signal in a sampling period of the receiving endcorresponding to the first off mode.

Wherein, in one embodiment, it can also clear the data in the workingunits that has been occupied, by the second input signal which has beencleared after output a first intensity value corresponding to the secondinput signal after the clearing process.

In one embodiment, the first signal correction module is also configuredto clear the data in the working units that has been occupied, by thesecond input signal which has been cleared after output a firstintensity value corresponding to the second input signal after theclearing process. the second signal correction module 840 is configuredto control the analog-digital converter in the receiving end to clearthe first input signal from a received third input signal after theclearing process, in a sampling period of the receiving endcorresponding to the second off mode by execute the steps of:

controlling the receiving end to acquire ambient infrared rays as thethird input signal, and outputting the third input signal to theanalog-digital converter of the receiving end in a sampling period ofthe receiving end corresponding to the second off mode;controlling the analog-digital converter to store the third input signalin the preset working unit; andclearing the preset data in the preset working units that has beenoccupied by the third input signal when the number of the preset workingunits occupied by the third input signal is equal to the number of thepreset working units occupied by the first input signal.

In one embodiment, the state determining module 850 is configured todetermine an approaching state or a leaving state based on the firstintensity value and the second intensity value by execute the steps of:

obtaining a proximity value by calculating an absolute value of thedifference between the first intensity value and the second intensityvalue;determining the proximity sensor is in the approaching state when theproximity value is greater than a first threshold; anddetermining the proximity sensor is in the leaving state when theproximity value is less than a second threshold.

In one embodiment, the first preset threshold is a preset proximitythreshold under a strong light environment control by a display, thesecond threshold is a preset distant threshold under a strong lightenvironment control by the display.

In one embodiment, the first input signal is the ambient infrared raysacquired by the receiving end when a LED lamp of the transmitting end isin an off mode, the second input signal is ambient infrared rays andinfrared rays acquired by the receiving end, and the infrared rays areemitted from the LED light and reflected by a blocking object when theLED lamp of the transmitting end is in an on mode. The embodiment of thepresent application further provides a storage medium having a programstored therein, when the program is executed by a processor, the methodfor controlling a proximity sensor is performed, the method includes:

outputting, a driving signal with a preset timing and a preset dutycycle, to a transmitting end and a receiving end of a proximity sensor,controlling the transmitting end to be in a sleep mode, an off mode, andan on mode periodically, and controlling the receiving end to be in asleep mode and a sampling mode periodically;controlling an analog-digital converter in the receiving end to store afirst input signal, in a sampling period of the receiving endcorresponding to the off mode; andcontrolling the analog-digital converter in the receiving end to clearthe first input signal from a received second input signal, andoutputting a first intensity value corresponding to the second inputsignal after the clearing process, thereby determining an approachingstate or a leaving state based on the first intensity value, in asampling period of the receiving end corresponding to the on mode.

Storage medium—any of a variety of types of memory devices or storagedevices. The term “storage medium” is intended to include: a mountingmedium such as a CD-ROM, a floppy disk or a tape device; a computersystem memory or a random access memory such as DRAM, DDR RAM, SRAM, EDORAM, Rambus RAM, etc. Non-volatile memory, such as flash memory,magnetic media (such as a hard disk or optical storage); registers orother similar types of memory elements, and the like. The storage mediummay also include other types of memory or a combination thereof.Additionally, the storage medium may be located in a first computersystem in which the program is executed, or may be located in adifferent second computer system, the second computer system beingcoupled to the first computer system via a network, such as theInternet. The second computer system can provide program instructions tothe first computer for execution. The term “storage medium” can includetwo or more storage media that can reside in different locations (e.g.,in different computer systems connected through a network). A storagemedium may store program instructions (eg, embodied as a computerprogram) executable by one or more processors.

Of course, the computer executable instructions are not limited to thecontrol operation of the proximity sensor as described above, in thestorage medium containing computer executable instructions provided bythe embodiments of the present application,

The present disclosure also provides a mobile terminal, the devicedescribed in the present disclosure is integrated into the mobileterminal mobile. FIG. 9 is a schematic structural view of a mobileterminal according to an embodiment of the present disclosure. Asillustrated in FIG. 9, the mobile terminal includes a housing (not shownin the figure), a touch screen (not shown in the figure), touch buttons(not shown in the figure), a memory 901, a Central Processing Unit 902(CPU, also known as the processor, hereinafter referred to as CPU), acircuit board (not shown in the figure) and a power circuit (not shownin the figure). The circuit board disposed inside the space enclosed bythe housing, the CPU 902 and the memory are disposed on the circuitboard, the power circuit is configured to supply power to each circuitor device of the mobile terminal, the memory 901, having executableprogram codes stored therein, the CPU 902, runs one or more computerprograms corresponding to the executable program codes by readingexecutable program codes stored in the memory 901 to implement thefollowing steps: outputting, a driving signal with a preset timing and apreset duty cycle, to a transmitting end and a receiving end of aproximity sensor, controlling the transmitting end to be in a sleepmode, an off mode, and an on mode periodically, and controlling thereceiving end to be in a sleep mode and a sampling mode periodically;

controlling an analog-digital converter in the receiving end to store afirst input signal, in a sampling period of the receiving end when it isin the off mode; andcontrolling the analog-digital converter in the receiving end to clearthe first input signal from a received second input signal, andoutputting a first intensity value corresponding to the second inputsignal after the clearing process, thereby determining an approachingstate or a leaving state based on the first intensity value, in asampling period of the receiving end when it is in the on mode.

Wherein, the mobile terminal further includes: a peripheral interface903, a radio frequency (RF) circuit 905, an audio circuit 906, a speaker911, a power management chip 908, an input/output (I/O) subsystem 909, atouch screen 912, others input/control devices 910 and external port904, these components communicate via one or more communication buses orsignal lines 907.

It should be understood that the illustrated mobile terminal 900 ismerely one example of a mobile terminal, and that the mobile terminal900 may have more or fewer components than those shown in the figure,and two or more components may be combined. Or it can have differentcomponent configurations. The various components shown in the figure canbe implemented in hardware, software, or a combination of hardware andsoftware, including at least one of one or more signal processing andapplication specific integrated circuits.

The mobile terminal for controlling a proximity sensor provided by thisembodiment, detailed description is as follows, and the mobile terminaltakes a mobile phone as an example.

The memory 901 can be accessed by the CPU 902, the peripheral interface903, etc, and the memory 901 can include a high speed random accessmemory, and can also include a non-volatile memory, such as one or moremagnetic disk storage devices, flash memory devices. Or other volatilesolid-state storage devices.

The peripheral interface 903, which can connect the input or outputperipherals of a device to the CPU 902 and the memory 901.

The I/O subsystem 909, which can connect input or output peripherals ofa device to the peripheral interface 903, such as the touch screen 912and the other input/control devices 910. The I/O subsystem 909 canincludes a display controller 9091 and one or more input controllers9092 for controlling the other input/control devices 910. Wherein, oneor more input controllers 9092 receives electrical signals from theother input/control devices 910 or transmits electrical signals to theother input/control devices 910. And the other input/control devices 910may include one or more physical buttons (press buttons, rocker buttons,etc.), a dial, a slide switch, a joystick or a click wheel. It is shouldbe noted that the input controllers 9092 can be connected to any of thefollowing: a keyboard, an infrared port, a USB interface, and a pointingdevice or a mouse.

The touch screen 912 is an input interface and an output interfacebetween the mobile terminal and the user, and displays the visual outputto the user. The visual output may include graphics, text, icons,videos, and the like.

The display controller 9091 in the I/O subsystem 909 receives anelectrical signal from the touch screen 912 or transmit an electricalsignal to the touch screen 912. The touch screen 912 detects the contacton the touch screen, and the display controller 9091 converts thedetected contact into an interaction with the user interface objectdisplayed on the touch screen 912, that is, realizes human-computerinteraction, and the user interface object displayed on the touch screen912 may be an icon of the game, an icon of the network to thecorresponding network, and the like. It is should be noted that, themobile terminal may also include a light mouse, which is a touchsensitive surface that does not display a visual output, or an extensionof a touch sensitive surface formed by the touch screen.

The RF circuit 905 is mainly configured to establish communicationbetween the mobile phone and the wireless network (i.e., the networkside), and implement data reception and transmission between the mobilephone and the wireless network. For example, sending and receiving shortmessages, emails, and the like. Specifically, the RF circuit 905receives and transmits an RF signal, which is also referred to as anelectromagnetic signal, and the RF circuit 905 converts the electricalsignal into an electromagnetic signal or converts the electromagneticsignal into an electrical signal, and through the electromagnetic signalto communicate with communication network and other devices. The RFcircuitry 905 may include known circuitry for performing these functionsincluding, but not limited to, an antenna system, an RF transceiver, oneor more amplifiers, a tuner, one or more oscillators, a digital signalprocessor, a codec CODER-DECoder (CODEC) chipset, Subscriber IdentityModule (SIM), etc.

The audio circuit 906 is configured to receive audio signal from theperipheral interface 903, convert the audio signal into an electricalsignal, and transmit the electrical signal to the speaker 911.

The speaker 911 is configured to restore the electrical signal receivedby the mobile phone from the wireless network through the RF circuit 905to sound and play the sound to the user.

The power management chip 908 is configured to supply power and powermanagement to the hardware connected to the CPU 902, the I/O subsystem,and the peripheral interface.

The mobile terminal provided by the embodiment of the presentapplication, by deducting the infrared rays in the ambient light in theanalog-digital converter, the influence of the infrared rays in theambient light can be eliminated, and the problem of the screen notturned off when it is in the approaching state under strong light can beavoided. Meanwhile, the problem of the splash screen in the light boxenvironment can be avoided. Thereby achieving normal functions of thescreen bright and off.

The method for controlling a proximity sensor provided by any of theembodiments of the present application, can be performed by each of thecontrolling device for a proximity sensor, the storage medium and themobile terminal provided by the embodiment of the present application,and each of the controlling device for a proximity sensor, the storagemedium and the mobile terminal has the corresponding functional modulesand beneficial effects of implementing the method. For technical detailsthat are not described in detail in the above embodiments, reference maybe made to the method for controlling a proximity sensor provided by anyof the embodiments of the present application.

What is claimed is:
 1. A method for controlling a proximity sensor, comprising: outputting, a driving signal with a preset timing and a preset duty cycle, to a transmitting end and a receiving end of a proximity sensor, controlling the transmitting end to be in a sleep mode, an off mode, and an on mode periodically, and controlling the receiving end to be in a sleep mode and a sampling mode periodically; controlling an analog-digital converter in the receiving end to store a first input signal, in a sampling period of the receiving end when the transmitting end is in the off mode; and controlling the analog-digital converter in the receiving end to clear the first input signal from a received second input signal, and outputting a first intensity value corresponding to the second input signal after the clearing process, thereby determining a proximity sensor is selectively in an approaching state or a leaving state based on the first intensity value, in a sampling period of the receiving end when the transmitting end is in the on mode.
 2. The method of claim 1, wherein the operation of controlling an analog-digital converter in the receiving end to store a first input signal, in a sampling period of the receiving end when the transmitting end is in the off mode comprises: controlling the receiving end to acquire ambient infrared rays as the first input signal, and outputting the first input signal to the analog-digital converter of the receiving end, in the sampling period of the receiving end when the transmitting end is in the off mode; controlling the analog-digital converter to store the first input signal in a plurality of preset working units; and recording the number of the preset working units that have been occupied by the first input signal as a reference value, and clearing data in the working units that have been occupied by the first input signal, when the receiving end is switched to be in the on mode from the off mode.
 3. The method of claim 2, wherein the operation of controlling the analog-digital converter in the receiving end to clear the first input signal from a received second input signal, in a sampling period of the receiving end when the transmitting end is in the on mode comprises: in a sampling period of the receiving end when the transmitting end is in the on mode, controlling the receiving end to receive infrared rays and ambient infrared rays to form the second input signal, and outputting the second input signal to the analog-digital converter, wherein the infrared rays are emitted from the transmitting end and reflected by a blocking object; controlling the analog-digital converter to store the second input signal in the preset working units; and clearing the preset data in the preset working units that have been occupied by the second input signal when the number of the preset working units occupied by the second input signal is equal to the reference value.
 4. The method of claim 1, wherein a time distribution of the LED lamp in the off mode, the on mode and the sleep mode is 1:1:8.
 5. The method of claim 1, wherein the off mode comprises a first off mode and a second off mode, the operation of controlling the transmitting end to be in a sleep mode, an off mode, and an on mode periodically comprises: controlling the transmitting end to be in the sleep mode, the first off mode, the on mode and the second off mode periodically; and the operation of controlling an analog-digital converter in the receiving end to store a first input signal in a sampling period of the receiving end when the transmitting end is in the off mode comprises: controlling the analog-digital converter in the receiving end to store the first input signal in a sampling period of the receiving end when the transmitting end is in the first off mode.
 6. The method of claim 5, wherein after the operation of outputting a first intensity value corresponding to the second input signal after the clearing process, the method further comprising: controlling the analog-digital converter in the receiving end to clear the first input signal from a received third input signal, and outputting a second intensity value corresponding to the third input signal after the clearing process, in a sampling period of the receiving end when the transmitting end is in the second off mode; and determining the proximity sensor is selectively in the approaching state or the leaving state based on the first intensity value and the second intensity value.
 7. The method of claim 6, wherein after the operation of outputting a first intensity value corresponding to the second input signal after the clearing process, the method further comprising: clearing the data in the preset working units that have been occupied by the second input signal after clearing process; and the operation of controlling the analog-digital converter in the receiving end to clear the first input signal from a received third input signal, in the sampling period of the receiving end when the transmitting end is in the second off mode comprises: controlling the receiving end to acquire ambient infrared rays as the third input signal, and outputting the third input signal to the analog-digital converter of the receiving end in the sampling period of the receiving end when the transmitting end is in the second off mode; controlling the analog-digital converter to store the third input signal in the preset working units; and clearing the preset data in the preset working units that have been occupied by the third input signal when the number of the preset working units occupied by the third input signal is equal to the number of the preset working units occupied by the first input signal.
 8. The method of claim 6, wherein the operation of determining the approaching state or the leaving state based on the first intensity value and the second intensity value comprises: obtaining a proximity value by calculating an absolute value of the difference between the first intensity value and the second intensity value; determining the proximity sensor is in the approaching state when the proximity value is greater than a first threshold; and determining the proximity sensor is in the leaving state when the proximity value is less than a second threshold.
 9. The method of claim 8, wherein the first threshold is a preset approaching threshold for screen control under a strong light environment, the second threshold is a preset leaving threshold for screen control under a strong light environment.
 10. The method of claim 5, wherein a time distribution of the LED lamp in the first off mode, the on mode, the second off mode and the sleep mode is about 1:1:1:7.
 11. The method of claim 1, wherein the first input signal is the ambient infrared rays received by the receiving end when an LED lamp of the transmitting end is in the off mode, and the second input signal is ambient infrared rays and infrared rays received by the receiving end, and the infrared rays are emitted from the LED light and reflected by a blocking object when the LED lamp of the transmitting end is in the on mode.
 12. A controlling device a for proximity sensor, comprising: a driving signal outputting module, configured to output a driving signal with a preset timing and a preset duty cycle, to a transmitting end and a receiving end of a proximity sensor, control the transmitting end to be in a sleep mode, an off mode, and an on mode periodically, and control the receiving end to be in a sleep mode and a sampling mode periodically; an input signal storing module, configured to control an analog-digital converter in the receiving end to store a first input signal in a sampling period of the receiving end when the transmitting end is in the off mode; and a first signal correction module, configured to control the analog-digital converter in the receiving end to clear the first input signal from a received second input signal, and output a first intensity value corresponding to the second input signal after the clearing process, thereby determine a proximity sensor is selectively in an approaching state or a leaving state based on the first intensity value, in a sampling period of the receiving end when the transmitting end is in the on mode.
 13. The device of claim 12, the device further comprising: a second signal correction module, when the off mode comprises a first off mode and a second off mode, configured to control the analog-digital converter in the receiving end to clear the first input signal from a received third input signal, and output a second intensity value corresponding to the third input signal after the clearing process, in a sampling period of the receiving end when the transmitting end is in the second off mode; and a state determining module, configured to determine the proximity sensor is selectively in an approaching state or a leaving state based on the first intensity value and the second intensity value.
 14. The device of claim 12, wherein the input signal storing module is configured to control an analog-digital converter in the receiving end to store a first input signal in a sampling period of the receiving end when the transmitting end is in the off mode by execute the steps of: controlling the receiving end to acquire ambient infrared rays as the first input signal, and outputting the first input signal to the analog-digital converter in the receiving end, in the sampling period of the receiving end when the transmitting end is in the off mode; controlling the analog-digital converter to store the first input signal in a plurality of preset working units; and recording the number of the preset working units occupied by the first input signal as a reference value, and clearing the preset data in the working units that has been occupied by the first input signal, when the receiving end is switched to be in the on mode from the off mode.
 15. The device of claim 14, wherein the first signal correction module is configured to control the analog-digital converter in the receiving end to clear the first input signal from a received second input signal, and output a first intensity value corresponding to the second input signal after the clearing process, in a sampling period of the receiving end when the transmitting end is in the on mode by execute the steps of: in a sampling period of the receiving end when the transmitting end is in the on mode, control the receiving end to acquire infrared rays and ambient infrared rays as the second input signal, and output the second input signal to the analog-digital converter, wherein the infrared rays are emitted from the transmitting end and reflected by a blocking object; controlling the analog-digital converter to store the second input signal in the preset working units; and clearing the preset data in the preset working units that has been occupied by the second input signal when the number of the preset working units occupied by the second input signal is equal to the reference value.
 16. The device of claim 12, wherein the off mode comprises a first off mode and a second off mode, the driving signal outputting module is configured to control the transmitting end to be in a sleep mode, an off mode, and an on mode periodically by execute the steps of: controlling the transmitting end to be in the sleep mode, the first off mode, the on mode and the second off mode periodically; and the input signal storing module is configured to control an analog-digital converter in the receiving end to store a first input signal in a sampling period of the receiving end corresponding to the off mode by execute the steps of: controlling the analog-digital converter in the receiving end to store the first input signal in a sampling period of the receiving end when the transmitting end is in the first off mode.
 17. The device of claim 13, wherein the first signal correction module is also configured to clear the data in the plurality of working units that has been occupied, by the second input signal which has been cleared after output a first intensity value corresponding to the second input signal after the clearing process; the second signal correction module is configured to control the analog-digital converter in the receiving end to clear the first input signal from a received third input signal after the clearing process, in a sampling period of the receiving end when the transmitting end is in the second off mode by execute the steps of: controlling the receiving end to acquire ambient infrared rays as the third input signal, and outputting the third input signal to the analog-digital converter of the receiving end in a sampling period of the receiving end when the transmitting end is in the second off mode; controlling the analog-digital converter to store the third input signal in a plurality of preset working unit; and clearing the preset data in the preset working units that has been occupied by the third input signal when the number of the preset working units occupied by the third input signal is equal to the number of the plurality of preset working units occupied by the first input signal.
 18. The device of claim 13, wherein the state determining module is configured to determine an approaching state or a leaving state based on the first intensity value and the second intensity value by execute the steps of: obtaining a proximity value by calculating an absolute value of the difference between the first intensity value and the second intensity value; determining the proximity sensor is in the approaching state when the proximity value is greater than a first threshold; and determining the proximity sensor is in the leaving state when the proximity value is less than a second threshold.
 19. A mobile terminal, comprising: a memory, having executable program codes stored therein; and a processor, coupled to the memory; wherein the processor invokes the executable program codes stored in the memory to perform a method for controlling a proximity sensor, the method comprising: outputting, a driving signal with a preset timing and a preset duty cycle, to a transmitting end and a receiving end of a proximity sensor, controlling the transmitting end to be in a sleep mode, an off mode, and an on mode periodically, and controlling the receiving end to be in a sleep mode and a sampling mode periodically; controlling an analog-digital converter in the receiving end to store a first input signal, in a sampling period of the receiving end when the transmitting end is in the off mode; and controlling the analog-digital converter in the receiving end to clear the first input signal from a received second input signal, and outputting a first intensity value corresponding to the second input signal after the clearing process, thereby determining a proximity sensor is selectively in an approaching state or a leaving state based on the first intensity value, in a sampling period of the receiving end when the transmitting end is in the on mode.
 20. The mobile terminal of claim 19, wherein the off mode comprises a first off mode and a second off mode, the operation of controlling the transmitting end to be in a sleep mode, an off mode, and an on mode periodically comprises: controlling the transmitting end to be in the sleep mode, the first off mode, the on mode and the second off mode periodically; and the operation of controlling an analog-digital converter in the receiving end to store a first input signal in a sampling period of the receiving end when the transmitting end is in the off mode comprises: controlling the analog-digital converter in the receiving end to store the first input signal in a sampling period of the receiving end when the transmitting end is in the first off mode. 